package com.cyj.dream.admin.model.system;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cyj.dream.core.base.SysBaseEntity;
import com.cyj.dream.core.constant.users.SexConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

/**
 * @Description: 通讯录
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.model.system
 * @Author: ChenYongJia
 * @CreateTime: 2021-05-19 14:05
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "dream_sys_contacts")
@TableName("dream_sys_contacts")
@ApiModel(value = "通讯录", description = "dream_sys_contacts 通讯录")
public class SysContacts extends SysBaseEntity implements Serializable {

    @ExcelProperty(value = "名称", index = 0)
    @ColumnWidth(15)
    @ApiModelProperty(value = "通讯录人员名称")
    @Column(columnDefinition = "varchar(64) COMMENT '通讯录人员名称'")
    private String sysContactsName;

    @ExcelProperty(value = "联系方式", index = 1)
    @ColumnWidth(15)
    @ApiModelProperty(value = "通讯录人员联系方式")
    @Column(columnDefinition = "varchar(11) COMMENT '通讯录人员联系方式'")
    private String sysContactsPhone;

    @ExcelProperty(value = "生日", index = 2)
    @ColumnWidth(15)
    @ApiModelProperty(value = "通讯录人员生日")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Column(columnDefinition = "DATETIME NOT NULL COMMENT '通讯录人员生日'")
    private Date sysContactsBirthday;

    @ExcelProperty(value = "年龄", index = 3)
    @ColumnWidth(8)
    @ApiModelProperty(value = "通讯录人员年龄")
    @Column(columnDefinition = "tinyint(3) DEFAULT 0 COMMENT '通讯录人员年龄'")
    private Integer sysContactsAge;

    @ExcelProperty(value = "性别", index = 4,converter = SexConverter.class)
    @ColumnWidth(8)
    @ApiModelProperty(value = "通讯录人员性别（0 未知 1 男 2 女）", example = "1")
    @Column(columnDefinition = "tinyint(3) DEFAULT 1  COMMENT '用户性别（0 未知 1 男 2 女）'")
    private Integer sysContactsSex;

    @ExcelProperty(value = "来源", index = 5)
    @ColumnWidth(20)
    @ApiModelProperty(value = "通讯录人员来源")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员来源'")
    private String sysContactsSource;

    @ExcelProperty(value = "邮箱", index = 6)
    @ColumnWidth(20)
    @ApiModelProperty(value = "通讯录人员邮箱")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员邮箱'")
    private String sysContactsEmail;

    @ExcelProperty(value = "业务类型--ContactsBusinessTypesEnum（0--软件开发 1--策划 2--运营）", index = 7)
    @ColumnWidth(15)
    @ApiModelProperty(value = "通讯录人员业务类型--ContactsBusinessTypesEnum（0--软件开发 1--策划 2--运营）")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员业务类型--ContactsBusinessTypesEnum（0--软件开发 1--策划 2--运营）'")
    private String sysContactsBusinessTypes;

    @ExcelProperty(value = "公司", index = 8)
    @ColumnWidth(30)
    @ApiModelProperty(value = "通讯录人员公司")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员公司'")
    private String sysContactsCompany;

    @ExcelProperty(value = "地址", index = 9)
    @ColumnWidth(30)
    @ApiModelProperty(value = "通讯录人员地址")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员地址'")
    private String sysContactsAddress;

    @ExcelProperty(value = "备注描述", index = 10)
    @ColumnWidth(30)
    @ApiModelProperty(value = "通讯录人员人员备注描述")
    @Column(columnDefinition = "varchar(255) COMMENT '通讯录人员人员备注描述'")
    private String sysContactsRemark;

    @ExcelProperty(value = "人员概要--简介", index = 11)
    @ColumnWidth(30)
    @ApiModelProperty(value = "通讯录人员人员概要--简介")
    @Column(columnDefinition = "varchar(500) COMMENT '通讯录人员人员概要--简介'")
    private String sysContactsSynopsis;

    /**
     * 通讯录人员人员所属项目名称
     */
    @ExcelIgnore
    @JsonIgnore
    @TableField(exist = false)
    @ApiModelProperty(value = "通讯录人员人员所属项目名称)")
    private String sysContactsInProjectName;

    @Override
    public String toString() {
        return "SysContacts{" +
                ", sysContactsName='" + sysContactsName + '\'' +
                ", sysContactsPhone='" + sysContactsPhone + '\'' +
                ", sysContactsAge=" + sysContactsAge +
                ", sysContactsSex=" + sysContactsSex +
                ", sysContactsSource='" + sysContactsSource + '\'' +
                ", sysContactsEmail='" + sysContactsEmail + '\'' +
                ", sysContactsBusinessTypes='" + sysContactsBusinessTypes + '\'' +
                ", sysContactsCompany='" + sysContactsCompany + '\'' +
                ", sysContactsAddress='" + sysContactsAddress + '\'' +
                ", sysContactsRemark='" + sysContactsRemark + '\'' +
                ", sysContactsInProjectName=" + sysContactsInProjectName +
                '}';
    }

    public static void main(String[] args) {
        BigDecimal numBig = new BigDecimal(10);
        BigDecimal avgBig = new BigDecimal(3);

        BigDecimal number = numBig.divide(avgBig, 2, RoundingMode.HALF_UP);
        System.out.println("计算后的值为："+ number);
    }

}
